home *** CD-ROM | disk | FTP | other *** search
/ QuickTime for the Web (2nd Edition) / QuickTime for the Web (2nd Edition).iso / pc / AppleScript / QUICKTIME 5.0.2 SCRIPTS / Script Templates / QT 5 Track Template < prev    next >
Encoding:
Text File  |  2001-06-26  |  2.4 KB  |  72 lines

  1. -- This script will process every track chosen by the user
  2. tell application "QuickTime Player"
  3.     activate
  4.     
  5.     try
  6.         if not (exists movie 1) then error "No movies are open."
  7.         
  8.         stop every movie
  9.         
  10.         -- CHECK FOR THE CORRECT VERSION OF QUICKTIME
  11.         set the QT_version to (the QuickTime version as string)
  12.         set the player_version to (the version as string)
  13.         set the required_version to "5.0.2"
  14.         if (the QT_version is less than the required_version) or ¬
  15.             (the player_version is less than the required_version) then
  16.             set the error_message to "This script requires QuickTime " & the required_version & "  or greater." & ¬
  17.                 return & return & ¬
  18.                 "Current QuickTime Version: " & QT_version & return & ¬
  19.                 "Current QuickTime Player Version: " & player_version
  20.             my upgrade_QT(error_message)
  21.         end if
  22.         
  23.         -- CHECK FOR QUICKTIME PRO
  24.         if QuickTime Pro installed is false then
  25.             set the error_message to "This script requires a QuickTime Pro installation on this system."
  26.             my upgrade_QT(error_message)
  27.         end if
  28.         
  29.         tell movie 1
  30.             -- CHECK IF THE MOVIE IS EDITABLE
  31.             if saveable is false then
  32.                 error "This movie has previously been set so that it cannot be copied, edited, or saved."
  33.             end if
  34.             set the track_list to the name of every track
  35.             set the track_names to ¬
  36.                 choose from list track_list with prompt "Command-click the target track(s):" with multiple selections allowed
  37.             if the track_names is false then error number -128
  38.             
  39.             repeat with i from 1 to the count of the track_names
  40.                 set this_trackname to item i of the track_names
  41.                 tell track this_trackname
  42.                     
  43.                     -- SCRIPT PROCESSING STATEMENTS GO HERE
  44.                     
  45.                 end tell
  46.             end repeat
  47.         end tell
  48.     on error error_message number error_number
  49.         if the error_number is not -128 then
  50.             beep
  51.             display dialog error_message buttons {"Cancel"} default button 1
  52.         end if
  53.     end try
  54. end tell
  55.  
  56. on upgrade_QT(passed_message)
  57.     tell application "QuickTime Player"
  58.         activate
  59.         stop every movie
  60.         set the target_URL to "http://www.apple.com/quicktime/download/"
  61.         display dialog passed_message & return & return & ¬
  62.             "If this computer is currently connected to the Internet, " & ¬
  63.             "click the “Upgrade” button to visit the QuickTime Website." buttons {"Upgrade", "Cancel"} default button 2
  64.         ignoring application responses
  65.             tell application "Finder"
  66.                 open location target_URL
  67.             end tell
  68.         end ignoring
  69.         error number -128
  70.     end tell
  71. end upgrade_QT
  72.